<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>微博</title>
    <style>
        *{
            margin: 0px;
            padding: 0px;
            list-style: none;
        }
        textarea{
            width: 500px;
            resize: none;
            margin:0px auto;
            display: block;
            outline: none;
        }
        ul{
            width: 800px;
            margin:0px auto;
        }
        li{
            margin:20px 0px;
            border:1px solid pink;
            position: relative;
            padding:20px;
        }
        .del{
            position: absolute;
            right:-10px;
            top:-10px;
            cursor: pointer;
        }
        button{
            width: 800px;
            background:#f66;
            border:none;
            outline: none;
            display: block;
            margin:20px auto;
            line-height: 40px;
            color: black;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <img src="images/iu.jpg" alt="">
    
    <textarea name="" id="txt" cols="30" rows="10"></textarea>
    <button id="btn">发送</button>
    <ul id="box">
        <li>
            今天打疫苗了
            <p>2021-06-15</p>
            <span class="del" onclick="del(this)">X</span>
        </li>
        <li>
           今天端午节HHHH
            <p>2021-06-14</p>
            <span class="del" onclick="del(this)">X</span>
        </li>
    </ul>
    <script>
        var btn=document.getElementById('btn');
        var txt=document.getElementById('txt');
        var box=document.getElementById('box');
        var year=new Date().getFullYear()
        var month=new Date().getMonth()+1
        var date=new Date().getDate()
        btn.onclick=function(){
            var val=txt.value;
            var tag=document.createElement('li');
            tag.innerHTML=`${val}
            <p>${year}-${month}-${date}</p>
            <span class="del" onclick="del(this)">X</span>`;
            box.appendChild(tag);
        }
        function del(a){
            a.parentNode.parentNode.removeChild(a.parentNode)
        }
    </script>

    
</body>
</html>